//
//  KAApplyResultBindcard.swift
//  kano
//
//  Created by Frank on 2025/5/12.
//

import UIKit

class KAApplyResultBindcard: UIView {
    
    //    lazy var var_cornerView: UIView = {
    //        let var_cornerView = UIView()
    //        var_cornerView.backgroundColor = UIColor.ka_hexColor(0xF6F7FA)
    //        var_cornerView.layer.cornerRadius = kscale(16)
    //        var_cornerView.layer.masksToBounds = true
    //        return var_cornerView
    //    }()
    
    public var var_tipLabel: UILabel = {
        let label = UILabel()
        label.numberOfLines = 0
        label.font = UIFont.systemFont(ofSize: kscale(14), weight: .medium)
        label.textColor = .black
        label.text = "You can bind your loan bank card when waiting. Once approved, you can proceed with the loan directly."
        return label
    }()
    
    lazy var var_smallCornerView: UIView = {
        let var_cornerView = UIView()
        var_cornerView.backgroundColor = UIColor.white
        var_cornerView.layer.cornerRadius = kscale(10)
        var_cornerView.layer.masksToBounds = true
        return var_cornerView
    }()
    
    lazy var var_addCardImg: UIImageView = {
        let imageView = UIImageView(image: UIImage(named: "applyResult_addCard"))
        return imageView
    }()
    
    public var var_titleLabel: UILabel = {
        let label = UILabel()
        label.numberOfLines = 1
        label.font = UIFont.systemFont(ofSize: kscale(14), weight: .bold)
        label.textColor = .black
        label.text = "Bind Bank Card"
        return label
    }()
    
    public var var_subTitleLabel: UILabel = {
        let label = UILabel()
        label.numberOfLines = 1
        label.font = UIFont.systemFont(ofSize: kscale(12), weight: .medium)
        label.textColor = UIColor.ka_hexColor(0x94908E)
        label.text = "Fast Disbursement"
        return label
    }()
    
    lazy var var_bindBtn: UIButton = {
        let button = UIButton()
        button.setTitle("Bind Now", for: .normal)
        button.setTitleColor(.white, for: .normal)
        button.titleLabel?.font = UIFont.systemFont(ofSize: kscale(17), weight: .bold)
        button.backgroundColor = .themeColor
        button.layer.cornerRadius = kscale(12)
        button.layer.masksToBounds = true
        return button
    }()

    
    
    init() {
        super.init(frame: CGRectMake(0, 0, var_screenWidth - kscale(40), kscale(192)))
        self.layer.cornerRadius = kscale(16)
        self.layer.masksToBounds = true
        ka_setUI()
    }
    required init?(coder: NSCoder) {
        fatalError("init(coder:) has not been implemented")
    }
    
    func ka_setUI() {
        backgroundColor = UIColor.ka_hexColor(0xF6F7FA)
        //        addSubview(var_cornerView)
        addSubview(var_tipLabel)
        addSubview(var_smallCornerView)
        addSubview(var_addCardImg)
        addSubview(var_titleLabel)
        addSubview(var_subTitleLabel)
        addSubview(var_bindBtn)
    }
    
    override func layoutSubviews() {
        super.layoutSubviews()
        var_tipLabel.snp.makeConstraints { make in
            make.left.equalTo(kscale(12))
            make.right.equalTo(kscale(-12))
            make.top.equalTo(kscale(12))
        }
        var_smallCornerView.snp.makeConstraints { make in
            make.left.equalTo(kscale(20))
            make.right.equalTo(kscale(-20))
            make.top.equalTo(var_tipLabel.snp.bottom).offset(kscale(10))
            make.bottom.equalTo(kscale(-14))
        }
        var_addCardImg.snp.makeConstraints { make in
            make.left.equalTo(var_smallCornerView.snp.left).offset(kscale(24))
            make.top.equalTo(var_smallCornerView.snp.top).offset(kscale(14))
            make.width.equalTo(kscale(32))
            make.height.equalTo(kscale(32))
        }
        var_titleLabel.snp.makeConstraints { make in
            make.left.equalTo(var_addCardImg.snp.right).offset(kscale(6))
            make.top.equalTo(var_addCardImg.snp.top)
        }
        var_subTitleLabel.snp.makeConstraints { make in
            make.left.equalTo(var_addCardImg.snp.right).offset(kscale(6))
            make.bottom.equalTo(var_addCardImg.snp.bottom)
        }
        var_bindBtn.snp.makeConstraints { make in
            make.left.equalTo(var_smallCornerView.snp.left).offset(kscale(12))
            make.right.equalTo(var_smallCornerView.snp.right).offset(kscale(-12))
            make.bottom.equalTo(var_smallCornerView.snp.bottom).offset(-12)
        }
    }
    
}
